﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MPlusTree
{
    public class Utilities
    {
        public static double EuclideDistance(double[] v1, double[] v2)
        {
            double result = 0;
            int n = v1.Length;
            int i;
            for (i = 0; i < n; ++i)
            {
                result += Math.Pow(v1[i] - v2[i], 2);
            }

            return Math.Sqrt(result);
        }

        public static float EuclideDistance(float[] v1, float[] v2)
        {
            double result = 0;
            int n = v1.Length;
            int i;
            for (i = 0; i < n; ++i)
            {
                result += Math.Pow(v1[i] - v2[i], 2);
            }

            return (float)Math.Sqrt(result);
        }
    }
}
